package com.eamois.ui.graph.util;

import java.awt.Component;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;

import com.ufidaicon.icons.BrowserUfidaIcons;

public class JobCardTreeRenderer extends DefaultTreeCellRenderer {
	public JobCardTreeRenderer() {

	}

	@Override
	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
				row, hasFocus);
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
//		if (node.isRoot()) {
//			setIcon(new ImageIcon(com.eamois.icon.GetIcons.class
//					.getResource("module.gif")));
//		}else {
//			setIcon(new ImageIcon(com.eamois.icon.GetIcons.class
//					.getResource("menu.gif")));
//		}
		if(node.isRoot()){
			setIcon(BrowserUfidaIcons.ICON_MATERIAL_CASTPART);
		}else if(node.getLevel()==1){
			setIcon(BrowserUfidaIcons.ICON_MATERIAL_CURRENCYPART);
		}else if(node.getLevel()==2){
			setIcon(BrowserUfidaIcons.ICON_MATERIAL_ASSISTPART);
		}else if(node.getLevel()==3){
			setIcon(BrowserUfidaIcons.ICON_FILE_TXTICON);
		}
		return this;
	}
}
